/*
 * Test.c
 *
 * Created: 27/04/2012 11:54:48
 *  Author: Dani
 */ 

#include <avr/io.h>
#define F_CPU 8000000
#include <util/delay.h>
#include "lcd162.h"
#include "engine.h"
//#include "switch.h"
#include "uart.h"

int main(void)
{
	LCDInit();
	LCDClear();
	_delay_ms(500);
	LCDDispString("Ready");
	EngineInit();
	
  InitUART(9600, 8, 0);

	while (1)
  {
    // Testing SendChar()
    SendChar('A');
    SendChar('B');
    SendChar('C');
	SendChar('\r');
    SendChar('\n');
	
	char ch = ReadChar();
	SendChar(ch);
	
	char str[25] = {'\0'} ;
	
	char *str1;
	
	LCDGotoXY(0,1);
	str1 = ReadString(str);
	SendString(str1);
	SendChar('\n');
	SendChar('\n');
	/*
	for (uint8_t i = 0; i < 16; i++)
	{
		// Testing ReadChar() : Read and echo
	    ch = ReadChar();
		if (ch != '\n')
		{
			SendChar(ch);
			LCDDispChar(ch);
		}		
		//LCDDispInteger(ch);
	    //SendChar('\r');
	    //SendChar('\n');
	}
	SendChar('q');
	
	while(1);
	
    // Testing CharReady()
    while ( !CharReady() )
    {}
    SendChar( ReadChar() );
    SendChar('\r');
    SendChar('\n');
	
    // Sending string stored in Flash (constant string)
    SendString("This string is stored as a constant in flash memory\r\n");
    
    // Sending string stored in SRAM (modify-able string)
    SendString(TestString);
	 
	// Testing SendInteger()
    //SendInteger(12345);
    SendChar('\r');
    SendChar('\n');    
    //SendInteger(-1000);
    SendChar('\r');
    SendChar('\n');  
	*/
  }
    while (1)
	{}
}
